import { useThemeStore } from '@/stores/theme'
import { storeToRefs } from 'pinia'

export function useTheme() {
  const themeStore = useThemeStore()
  const { isDark } = storeToRefs(themeStore)

  const toggleTheme = () => {
    themeStore.toggleTheme()
  }

  const setDarkMode = (dark: boolean) => {
    themeStore.setDarkMode(dark)
  }

  return {
    isDark,
    toggleTheme,
    setDarkMode
  }
}

